package com.java.merchant.service.impl;

import com.java.androidmarket.entity.Goods;
import com.java.androidmarket.utils.RedisUtils;
import com.java.merchant.dao.Me_GoodsDao;
import com.java.merchant.service.GoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * description:
 * author:张腾
 * date:2021-07-23
 */

@Service("merchant_goodsService")
public class GoodsServiceImpl implements GoodsService {
    @Autowired
    private Me_GoodsDao meGoodsDao;
    @Autowired
    private RedisUtils redisUtils;

    @Override
    public void insertGoods(Goods goods) {
        meGoodsDao.insertGoods(goods);
    }

    @Override
    public void updateGoods(Goods goods) {
        meGoodsDao.updateGoods(goods);
    }

    @Override
    public void deleteGoods(int goodsId) {
        meGoodsDao.deleteGoods(goodsId);
    }

    @Override
    public void deleteRedis() {
        if (redisUtils.exists("goods")){
            redisUtils.del("goods");
        }
    }
}
